<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>得到圆周率值</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.octdec.html">octdec</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.pow.html">pow</a></div>
 <div class="up"><a href="ref.math.html">Math 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.pi" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">pi</h1>
    <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">pi</span> &mdash; <span class="dc-title">得到圆周率值</span></p>

   </div>
 <div class="refsect1 description" id="refsect1-function.pi-description">
  <h3 class="title">说明</h3>
     <div class="methodsynopsis dc-description">
      <span class="type">float</span> <span class="methodname"><strong>pi</strong></span>
       ( <span class="methodparam">void</span>
      )</div>

    <p class="simpara">
     返回圆周率的近似值。返回值的 <span class="type"><a href="language.types.float.html" class="type float">float</a></span>
     精度是由 <var class="filename">php.ini</var> 中的 <a href="ini.core.html#ini.precision" class="link">precision</a>
     指令确定。默认值是 <em>14</em>。你也可以使用
     <strong><code>M_PI</code></strong> 常量，该常量产生与 <span class="function"><strong>pi()</strong></span> 完全相同的结果。
    </p>
   </div>

 <div class="refsect1 returnvalues" id="refsect1-function.pi-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   圆周率（pi）的浮点近似值。
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.pi-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3378">
    <p><strong>Example #1 <span class="function"><strong>pi()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">pi</span><span style="color: #007700">();&nbsp;</span><span style="color: #FF8000">//&nbsp;3.1415926535898<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">M_PI</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;3.1415926535898<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

  </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.octdec.html">octdec</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.pow.html">pow</a></div>
 <div class="up"><a href="ref.math.html">Math 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
